﻿using System.Windows;
using System.Windows.Controls;
using Dsl.Ped.Desktop.ViewModels;

namespace Dsl.Ped.Desktop.Views
{
    /// <summary>
    /// Interaction logic for RibbonBarBarView.xaml
    /// </summary>
    public partial class RibbonBarView : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="RibbonBarView"/> class.
        /// </summary>
        public RibbonBarView()
        {
            this.InitializeComponent();
            this.DataContext = new RibbonBarViewModel();
        }

        /// <summary>
        /// Hides Quick Access Toolbar from Ribbon.
        /// </summary>
        /// <param name="sender">RibbonApplicationMenu</param>
        /// <param name="e">RoutedEventArgs</param>
        private void Ribbon_Loaded(object sender, RoutedEventArgs e)
        {
            var titlePanel = this.Ribbon.Template.FindName("PART_TitlePanel", this.Ribbon) as FrameworkElement;
            if (titlePanel != null)
            {
                var titlePanelHost = titlePanel.Parent as FrameworkElement;
                if (titlePanelHost != null)
                {
                    titlePanelHost.Visibility = System.Windows.Visibility.Collapsed;
                }
            }
        }
    }
}
